package share.common.utils;

import java.io.FileNotFoundException;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.eu.base.buffer.RuntimeConfigure;
import org.eu.config.ConfigManager;



public class InitializeListener implements ServletContextListener {

	public interface Log {

	}

	public void contextDestroyed(ServletContextEvent arg0) {
		//ConnectionPool.getInstance().empty();
		return;
	}

	public void contextInitialized(ServletContextEvent arg0) {
		String path=arg0.getServletContext().getRealPath("/WEB-INF/system.conf");
		try {
			ConfigManager.loadGlobalConfigFile(path);
		} catch (FileNotFoundException e) {
			System.err.println("/WEB-INF/system.conf not found");
		}
		ConfigManager.setEnviroment("WebRoot",arg0.getServletContext().getRealPath("/"));
		RuntimeConfigure.setBufferDirectory(ConfigManager.getEnviroment("WebRoot")+"/WEB-INF/buffer/");
		System.out.println("初始化完成");
	}

}
